package langs;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

public class Langs {
	private static final Map<String, HashMap<String, String>> messages;
	static {
		Map<String, HashMap<String, String>>tempMap = new HashMap<String, HashMap<String, String>>();
		HashMap<String, String> en = new HashMap<String, String>();
		HashMap<String, String> sc = new HashMap<String, String>();
		HashMap<String, String> tc = new HashMap<String, String>();
		en.put("pagetitle", "Petpetlink");
		sc.put("pagetitle", "宠物链");
		tc.put("pagetitle", "寵物鏈");
		tempMap.put("en", en);
		tempMap.put("sc", sc);
		tempMap.put("tc", tc);
		messages = Collections.unmodifiableMap(tempMap);
	}
	private static String defaultLang;
	
	public static boolean langExists(String lang){
		if(messages.get(lang)!=null){
			return true;
		}else{
			return false;
		}
	}
	
	public static void setDefaultLang(String lang){
		defaultLang = lang;
	}
	
	public static String get(String lang, String key){
		return messages.get(lang).get(key);
	}
	
	public static String get(String key){
		return messages.get(defaultLang).get(key);
	}
}
